package com.xiaoshuidi.cloud.module.member.controller.admin.questionnaireinfo;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.member.controller.admin.questionnaireinfo.vo.QuestionCreateVO;
import com.xiaoshuidi.cloud.module.member.controller.admin.questionnaireinfo.vo.QuestionnaireInfoUpdateVO;
import com.xiaoshuidi.cloud.module.member.enums.ApiConstants;
import com.xiaoshuidi.cloud.module.member.service.questionnaireinfo.MemberQuestionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import java.util.List;

import static com.xiaoshuidi.cloud.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 问卷题目")
@RestController
@RequestMapping(ApiConstants.NAME + "/question")
@Validated
public class MemberQuestionController {
    @Resource
    private MemberQuestionService memberQuestionService;

    @PostMapping("/batch-create/{questionnaireId}")
    @Operation(summary = "批量创建题目")
    public CommonResult<Boolean> batchCreate(@PathVariable("questionnaireId") Long questionnaireId, @Valid @RequestBody List<QuestionCreateVO> createReqVOs) {
        return success(memberQuestionService.batchCreate(questionnaireId, createReqVOs));
    }

}
